package com.tj.jinzao.widgets;


import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;

import com.tj.jinzao.R;
import com.tj.jinzao.utils.ToastUtils;


/**
 * 选择人物
 * Created by wjy on 2019/1/6.s
 */
public class ChoosePassWordDialog extends Dialog  {
    private EditText passWord;
    private TextView exit;
    private TextView config;
    private Context mContext;

    public ChoosePassWordDialog(Context context) {
        super(context);
        this.mContext=context;
    }

    public ChoosePassWordDialog(Context context, int theme) {
        super(context, theme);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.dialog_choose_password);
        passWord=findViewById(R.id.passWord);
        exit=findViewById(R.id.exit);
        config=findViewById(R.id.config);
        config.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(onClickLinstener!=null){
                    if(TextUtils.isEmpty(passWord.getText())){
                        ToastUtils.showToast(mContext,"请输入密码");
                        return;
                    }
                    onClickLinstener.onConfig(passWord.getText().toString());
                }

            }
        });
        exit.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                if(onClickLinstener!=null){
                    onClickLinstener.onExit();
                }

            }
        });
    }

    private String mContent;
    private OnClickLinstener onClickLinstener;
    public interface OnClickLinstener{
        void onConfig(String mContent);
        void onExit();
    }
    public void setOnClickLinstener(OnClickLinstener onClickLinstener){
        this.onClickLinstener=onClickLinstener;
    }



    public String getContent() {
        return mContent;
    }
}
